package charts; 
import charts.series.Element;
import charts.series.bars.Outline;
//import charts.Structs.BarOutlineStyleStruct;
import string.Utils;

typedef OutlineStyleStruct = {
  var values		: Array<Float>;
  var tip		: String;
  var text		: String;
  var outline_colour	: String;
  var onclick		: Dynamic;
  var line_style	: charts.LineStyle;
  var font_size		: String;
  var colour		: String;
  var axis		: String;
  var alpha		: Float;
};

class BarOutline extends BarBase<OutlineStyleStruct, Outline> {
	
	var outline_colour:Float;
	
	public function new( json:Dynamic, group:Float ) {
		
		//
		// specific value for outline
		//
		var style : OutlineStyleStruct = { outline_colour : "#000000" };
/*
		var style : {
			values : Array<Float>
			, tip : String
			, text : String
			, outline_colour : String
			, onclick : Dynamic
			, line_style : charts.LineStyle
			, font_size : String
			, colour : String
			, axis : String
			, alpha : Float } =
		{
			outline_colour: "#000000"
		};
*/
/*
		var style:BarOutlineStyleStruct = {
			outline_colour:	"#000000"
		};
*/
		
		Object_helper.merge_2( json, style );
		
		super( json, group );
	}
	
	//
	// called from the base object
	//
	override function get_element( index:Float, value:Dynamic ): Outline {
		
		var default_style:Dynamic = this.get_element_helper( value );
		
		if ( !default_style.outline_colour )
			default_style.outline_colour = this.style.outline_colour;
		
		if( Std.is( default_style.outline_colour, String) )
			default_style.outline_colour = Utils.get_colour( default_style.outline_colour );
			
		return new Outline( index, default_style, this.group );
	}
}
